<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<!-- Here is CSS file -->
		<title>Array#sort在各个JS引擎上的算法</title>
		<style>
			html, body{margin:0;padding:0;background-color:#EEE;}
			.ct{width:80%;padding:10px;margin:50px auto 0px auto;background-color:#EEE;}
			.ct .title{text-align:center;padding:10px 0;font-family:"微软雅黑";}
			.ct .cp{background-color:#CCC;margin:20px 10px;padding:5px; width:30%;float:left;height:18em;}
		</style>
		<script>
			var r = function(str){document.write(str+"<br />");},
				wr = function(str){document.write(str);},
				g = document.getElementById;
			var arr1 = [12,4,7],
					arr2 = [12,4,7, 5],
					arr3 = [12,4,7, 5, -3];
		</script>
	</head>
	
	<body>
		<div id="header"></div>
		<div class="ct" id="container">
			<h1 class="title">Array#sort在各个JS引擎上的算法</h1>
			
			<div class="cp">
				<script>
					x = 0;
					r("【"+arr1+"】");
					wr("<hr />");
					arr1.sort(function(a, b){
						r(++x + ":　[" + a +"," + b+"]"+arr1); return a-b;
					});
					r("【"+arr1+"】");
				</script>
			</div>
			
			<div class="cp">
				<script>
					x = 0;
					r("【"+arr2+"】");
					wr("<hr />");
					arr2.sort(function(a, b){
						r(++x + ":　[" + a +"," + b+"]"+arr2); return a-b;
					});
					r("【"+arr2+"】");
				</script>
			</div>
			
			<div class="cp">
				<script>
					x = 0;
					r("【"+arr3+"】");
					wr("<hr />");
					arr3.sort(function(a, b){
						r(++x + ":　[" + a +"," + b+"]"+arr3); return a-b;
					});
					r("【"+arr3+"】");
				</script>
			</div>
			
		</div>
		<div id="footer"></div>
	</body>
	
</html>
